package com.ato.java;

/**
 * @author wangjing
 * @create 2021--06--16--21:28
 */
public class ArrayTest6 {
    public static void main(String[] args){
/*
*   冒泡排序:
*   比较相邻两个的
*
* */

        int[] arr = new int[]{43,234,432,52,3546,245,234,243,432,42,43,56,224324,2342};
//        String类型也可以。按照unicode编码

        for (int i =0 ;i<arr.length-1;i++){
            for (int j = 0;j<arr.length-1-i;j++){
                if(arr[j]>arr[j+1]){
                    int temp = arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
            }

        }

        for (int i = 0 ;i<arr.length;i++){
            System.out.println(arr[i]);
        }
    }
}
